import { combineReducers, legacy_createStore, compose, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';

import loginReducer from './Login/reducer';
import homeReducer from './Home/reducer';
import wordReducer from './Word/reducer';
import learnReducer from './Learn/reducer';

//合并reducer
const rootReducer = combineReducers({
  login: loginReducer,
  home: homeReducer,
  word: wordReducer,
  learn: learnReducer
});


const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) : compose;

const store = legacy_createStore(
  rootReducer, 
  composeEnhancers(applyMiddleware(thunk))
);


export default store;